package com.wuqing.dubbo03.utils;

import java.util.concurrent.TimeUnit;

/**
 * @author wuqing
 * @date 2020/8/8
 */
public class RandomUtils {

    public static int random(int max, int min) {
        return (int) (Math.random() * (max - min) + min);
    }

    public static void randomSleep(int max){
        try {
            TimeUnit.MILLISECONDS.sleep(RandomUtils.random(max,0));
        }catch (Exception e){
            System.out.println("发生异常");
        }
    }

    public static void sleep20(){
        try {
            TimeUnit.MILLISECONDS.sleep(RandomUtils.random(20,0));
        }catch (Exception e){
            System.out.println("发生异常");
        }
    }

}